PadWalker is a module which allows you to inspect (and even change!)
lexical variables in any subroutine which called you. It will only show
those variables which are in scope at the point of the call.

PadWalker is particularly useful for debugging. It can even be used by
Perl's built-in debugger.
